package no.gnet.edvd.types;

public class ActivityType extends Persist {
	private static final long serialVersionUID = 7224031207055314129L;
	public static ActivityType MONEYTRANS;
	public static ActivityType LOGIN;
	public static ActivityType USERCREATION;
	public static ActivityType USERDELETION;
	public static ActivityType BLOCKED;
	public static ActivityType EVENT_TRANSITION;
	public static ActivityType WINNER_SET;
	public static ActivityType BET_PLACED;
	public static ActivityType BET_WHATIF;
	public static ActivityType PAYMENT;
	public static ActivityType UNSPECIFIED;
	
	public String name;
	public String description;

	static {
		MONEYTRANS = createActivityType("MONEYTRANS", "Money transactions", 1);
		LOGIN = createActivityType("LOGIN", "Login", 2);
		USERCREATION = createActivityType("USERCREATION", "User created", 3);
		USERDELETION = createActivityType("USERDELETION", "User inactivated", 4);
		BLOCKED = createActivityType("BLOCKED", "User blocked", 5);
		EVENT_TRANSITION = createActivityType("EVENT_TRANSITION", "Event transitioned", 6);
		WINNER_SET = createActivityType("WINNER_SET", "Winner set", 7);
		BET_PLACED = createActivityType("BET_PLACED", "Bet placed", 8);
		BET_WHATIF = createActivityType("BET_WHATIF", "What if bet", 9);
		PAYMENT = createActivityType("PAYMENT", "Payment", 10);
		UNSPECIFIED = createActivityType("UNSPECIFIED", "Unspecified activity", 999);
	}

	private static ActivityType createActivityType(String name, String description, int id) {
		ActivityType at = new ActivityType(name, description);
		at.id = id;
		return at;
	}

	public ActivityType(String name, String desc) {
		super();
		this.name = name;
		this.description = desc;
	}

	public static ActivityType getById(int activitytype) {
		switch (activitytype) {
		case 1:
			return MONEYTRANS;
		case 2:
			return LOGIN;
		case 3:
			return USERCREATION;
		case 4:
			return USERDELETION;
		case 5:
			return BLOCKED;
		case 6:
			return EVENT_TRANSITION;
		case 7:
			return WINNER_SET;
		case 8:
			return BET_PLACED;
		case 9:
			return BET_WHATIF;	
		case 10:
			return PAYMENT;				
		default:
			return UNSPECIFIED;
		}
	}
}
